//
//  XFYLocalData.h
//  MyRobotApp
//
//  Created by 小肥羊 on 15/5/29.
//  Copyright (c) 2015年 小肥羊. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "FMDatabase.h"

#define DATABASE_PATH(str) ([NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0]stringByAppendingString:[[NSString alloc] initWithFormat:@"/%@.db",(str)]])

@interface XFYLocalData : NSObject

@property (nonatomic,strong) FMDatabase *db;
@property (nonatomic,strong) NSString *dataPath;

- (id)initWithPath:(NSString *)string;

- (BOOL)openDB;
- (BOOL)closeDB;

#pragma mark - 数据操作
/*! @brief 添加碎片数据 */
- (BOOL)addFragmentData:(NSString *)fragmentData;
/*! @brief 添加消息记忆数据 */
- (BOOL)addMessageMemory:(NSDate *)memoryDate Content:(NSString *)content;
/*! @brief 添加认知类型数据 */
- (BOOL)addCognition:(NSString *)cognition CognitionTableName:(NSString *)tableName;

/*! @brief 修改碎片数据 */
- (BOOL)modifyFragmentData:(NSString *)oldData fragmentData:(NSString *)newData;
/*! @brief 删除碎片数据 */
- (BOOL)deleteFragmentData:(NSString *)data;



/*! @brief 查找碎片数据 */
- (FMResultSet *)searchAllFragmentData;
/*! @brief 查找消息记忆数据 */
- (FMResultSet *)searchAllMessageMemory;
/*! @brief 查找认知数据 */
- (FMResultSet *)searchAllCognition;

@end
